package org.stone.project.tx.sysEnum;

import cn.hutool.core.util.ObjectUtil;

/**
 * 消息类别
 */
public enum TxType {
    LOGIN(1,"客户端登录"),
    SEND_MSG(2,"客户端发消息"),
    RECEIEVE_MSG(3,"客户端收消息"),
    LOGOUT(4,"客户端登出"),
    ;

    public Integer code;

    public String describ;

    TxType(Integer code, String describ) {
        this.code = code;
        this.describ = describ;
    }

    public static TxType getInstance(Integer code){
        if (ObjectUtil.isNull(code)){
            return null;
        }
        TxType[] values = values();
        for (TxType value : values) {
            if (value.code.equals(code))
                return value;
        }
        return null;
    }
}
